<?php

/**
 * Endereco form base class.
 *
 * @package    form
 * @subpackage endereco
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseEnderecoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_endereco'            => new sfWidgetFormInputHidden(),
      'nu_cep'                 => new sfWidgetFormInput(),
      'logradouro'             => new sfWidgetFormInput(),
      'logradouro_numero'      => new sfWidgetFormInput(),
      'logradouro_complemento' => new sfWidgetFormInput(),
      'bairro'                 => new sfWidgetFormInput(),
      'cidade'                 => new sfWidgetFormInput(),
      'sg_uf'                  => new sfWidgetFormInput(),
      'estado'                 => new sfWidgetFormInput(),
      'ds_maps'                => new sfWidgetFormTextarea(),
      'id_sistema'             => new sfWidgetFormDoctrineChoice(array('model' => 'Sistema', 'add_empty' => true)),
      'user_id'                => new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardUserProfile', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id_endereco'            => new sfValidatorDoctrineChoice(array('model' => 'Endereco', 'column' => 'id_endereco', 'required' => false)),
      'nu_cep'                 => new sfValidatorInteger(),
      'logradouro'             => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'logradouro_numero'      => new sfValidatorInteger(array('required' => false)),
      'logradouro_complemento' => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'bairro'                 => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'cidade'                 => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'sg_uf'                  => new sfValidatorString(array('max_length' => 2, 'required' => false)),
      'estado'                 => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'ds_maps'                => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'id_sistema'             => new sfValidatorDoctrineChoice(array('model' => 'Sistema', 'required' => false)),
      'user_id'                => new sfValidatorDoctrineChoice(array('model' => 'sfGuardUserProfile', 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('endereco[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Endereco';
  }

}
